﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuanLyBanHang.DAL;
using QuanLyBanHang.VO;


namespace QuanLyBanHang.BUS
{
    public class PhieuNhap_BUS
    {
        PhieuNhap_DAL pn_dal = new PhieuNhap_DAL();
        public bool insert(PhieuNhap_VO pn)
        {

            if (pn_dal.insertPN(out pn.MaPN, pn.MaNV, pn.NCC, pn.TongGia))
            {
                foreach (CartItem c in pn.Items)
                {
                    pn_dal.insertCTPN(pn.MaPN, c.MaSP, c.soluong, c.gia);
                }
                return true;
            }
            else
                return false;
        }
    }
}
